﻿using System.Web.Mvc;
using Pixster.Controllers.Helpers;
using Pixster.Models;

namespace Pixster.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        [AcceptVerbs(HttpVerbs.Get), OutputCache(CacheProfile = "Homepage")]
        public ActionResult Index()
        {
            var serverPath = Server.MapPath(AppHelper.PhotoRoot);

            var sitemap = ManifestHelper.GetSitemap(serverPath);

            return sitemap == null ? View("Error") : View(new PixsterViewModel {Sitemap = sitemap});
        }
    }
}